<%@page contentType="text/html;charset=UTF-8"%>
<%@page import="java.util.List,com.xxxx.oa.bean.Dept" %>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>部门列表页面</title>
	</head>
	<body>
	<h3>欢迎<%=session.getAttribute("loginName")%></h3>
	<a href="<%=request.getContextPath()%>/user/logout">退出登录</a>
	<script type="text/javascript">
	    function del(dno){
		if(window.confirm("亲，确定删除嘛？")){
		document.location.href="<%=request.getContextPath()%>/dept/delete?dno="+dno;
		}
		}
		</script>
		<h1 align="center">部门列表</h1>
		<hr >
		<table border="1px" align="center" width="50%">
			<tr>
				<th>序号</th>
				<th>部门编号</th>
				<th>部门名称</th>
				<th>操作</th>
			</tr>

			<%
				List<Dept> deptList=(List<Dept>)request.getAttribute("deptList");
				int i=0;
				for(Dept dept:deptList){


			%>

			<tr>
				<td><%=++i%></td>
				<td><%=dept.getDno()%></td>
				<td><%=dept.getDname()%></td>
				<td>
					<a href="javascript:void(0)" onclick="del(<%=dept.getDno()%>)">删除</a>
					<a href="<%=request.getContextPath()%>/dept/detail?f=edit&dno=<%=dept.getDno()%>">修改</a>
					<a href="<%=request.getContextPath()%>/dept/detail?f=detail&dno=<%=dept.getDno()%>">详情</a>
				</td>
			</tr>

			<%
				}
			%>


			


		</table>
	<hr>
	<a href="<%=request.getContextPath()%>/add.jsp">新增部门</a>
	</body>
</html>